const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin')
const webpack  = require('webpack')


module.exports={
    entry:{
        // entry:"./src/index.js",
        // entry2:"./src/index2.js",
        // app:'./src/index.js',
        // print:'./src/print.js',
        app:'./src/index.js',
    },
    devtool:'inline-source-map',
    devServer:{
        contentBase:'./dist',
        hot:true
    },
    plugins:[
        new CleanWebpackPlugin(),
        new HtmlWebpackPlugin({
            title:'Output Management'
        }),
        new webpack.NamedModulesPlugin(),
        new webpack.HotModuleReplacementPlugin()
    ],
    output:{
        filename:'[name].bundle.js',
        // filename:'bundle.js',
        path:path.resolve(__dirname,'dist'),
        publicPath: '/'
    },
    module:{
        rules:[
            {
                test:/\.css$/,
                use:[
                    'style-loader',
                    'css-loader'
                ]
            },{
                test:[/\.(png|svg|jpg|gif)$/],
                use:'file-loader'
            }
        ]
    }
}